<?php
namespace app\modules\models;

use yii\rbac\Rule;// execute权限规则的判断

use Yii;

class AuthorRule extends Rule
{
    
    public $name = "isAuthor";

    public function execute($user, $item, $params)
    {
        $action = Yii::$app->controller->action->id;
        if ($action == 'del') {
            $cateid = Yii::$app->request->get("cateid");
            $cate = Menu::findOne($cateid);
            return $cate->cuid == $user;
        }
        return true;
    }

}
